package com.oren.base;

import com.oren.config.DatabaseHelper;
import com.oren.util.EntityUtil;
import org.apache.commons.dbutils.handlers.BeanListHandler;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import java.sql.Connection;
import java.sql.SQLException;
import java.util.List;

/**
 * Created by IntelliJ IDEA.
 * User: wangshiwei
 * Date: 2018/7/13
 * Time: 15:45
 * describe: 操作数据库的公共类
 */
public  interface SqlDao<T> {

    /**
     * 查询返回实体类的集合
     * @param entity
     * @param sql
     * @param params
     * @return
     */
     List<T> queryEntity(Class<T> entity, String sql, Object... params);

    /**
     * 增加数据
     * @param entity
     * @return
     */
     boolean insertEntity(T entity);

    /**
     * 修改数据
     * @param entity
     * @param columnStr
     * @return
     */
     boolean updateEntity(T entity,String[] columnStr);

    /**
     * 删除数据
     * @param entity
     * @param columnStr
     * @return
     */
     boolean deleteEntity(T entity,String[] columnStr);
}
